package Day05;

public class Text7 {
    public static void main(String[] args) {
        //输入：nums = [2,7,11,15], target = 9
        //输出：[0,1]
        //解释：因为 nums[0] + nums[1] == 9 ，返回 [0, 1] 。

        int[] a = {1,2,3,4,56,7};
        int target = 3;
        System.out.println(add(a, target));
    }
    public static String add(int[] a,  int target){
        for (int i = 0; i < a.length; i++) {
            for (int i1 = 0; i1 < a.length; i1++) {
                if(a[i] + a[i1] == target){
                    return "[" + i +", " + i1 + "]";
                }
            }
        }
        return "没有元素满足";

    }
}
